package com.itheima.导入和导出;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

public class Thread_out extends Thread{
    @Override
    public void run() {
        try {
            System.out.println("菜单的导出功能");
            ZipOutputStream zos = new ZipOutputStream(new FileOutputStream("D:\\z.zip"));
            ZipEntry entry = new ZipEntry("a.txt");
            FileInputStream fis = new FileInputStream("diary/src/Text/mytext");
            zos.putNextEntry(entry);
            int f;
            while((f=fis.read())!=-1){
                zos.write(f);
            }
            fis.close();
            zos.closeEntry();
            zos.close();
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }
}
